package com.logistics.dao;

import java.util.List;

import org.springframework.stereotype.Repository;

import com.logistics.TimeTemplate;

import cn.easybuild.core.hibernate.StringPojoHibernateHandler;

@Repository
public class TimeTemplateDaoImpl extends StringPojoHibernateHandler<TimeTemplate> implements TimeTemplateDao {

	@Override
	public List<TimeTemplate> queryAvailable(boolean type) {
		StringBuffer hql = new StringBuffer(" from ");
		hql.append(TimeTemplate.class.getName());
		hql.append(" where enabled = ?");
		hql.append(" and type = ?");
		return query(hql.toString(), true, type);
	}

	@Override
	protected Class<TimeTemplate> getEntityClass() {
		return TimeTemplate.class;
	}

	@Override
	public List<TimeTemplate> query() {
		StringBuffer hql = new StringBuffer(" from ");
		hql.append(TimeTemplate.class.getName());
		return query(hql.toString());
	}

}
